
import Mta from "@/utils/track/myMta.js";
var nav = {
	navigateTo: ({
		id,url,type
	}) => {
		var link = '/' + getCurrentPages()[getCurrentPages().length - 1].route;
		uni.navigateTo({
			url: url,
			success: function(res) {
				Mta.myMta(id,url,type,link)
			}
		});
	},
	redirectTo: ({
		url
	}) => {
		var link = '/' + getCurrentPages()[getCurrentPages().length - 1].route;
		Mta.myMta('leaveStr', link)
		console.log('redirectTo', link,'-',url)
		uni.redirectTo({
			url: url,
			success: function(res) {
				Mta.myMta('entryStr', url)
			}
		});
	},
	reLaunch: ({
		url
	}) => {
		var link = getCurrentPages()[getCurrentPages().length - 1].route;
		Mta.myMta('leaveStr', link)
		console.log('reLaunch', link,'-',url)
		uni.reLaunch({
			url: url,
			success: function(res) {
				Mta.myMta('entryStr', url)
			}
		});
	},
	switchTab: ({
		url
	}) => {
		var link = getCurrentPages()[getCurrentPages().length - 1].route;
		Mta.myMta('leaveStr', link)
		console.log('switchTab', link,'-',url)
		uni.switchTab({
			url: url,
			success: function(res) {
				Mta.myMta('entryStr', url)
			}
		});
	},
	navigateBack: ({
		num
	}) => {
		var link = getCurrentPages()[getCurrentPages().length - 1].route;
		Mta.myMta('leaveStr', link)
		console.log('navigateBack', link,'-',num)
		uni.navigateBack({
			delta: num
		});
	}

}
export default { ...nav
};